#!/bin/bash
NDK=C:/androidsdk/ndk/16.1.4479499
PLATFORM=$NDK/platforms/android-21/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
PREFIX=./android/armeabi-v7a

function build_one
{
  ./configure \
  --prefix=$PREFIX \
  --includedir=./platform/my_x264/app/src/main/cpp/x264/armeabi-v7a \
  --libdir=./platform/my_x264/app/src/main/jniLibs/armeabi-v7a \
  --enable-static \
  --enable-shared \
  --enable-pic \
  --host=arm-linux-androideabi \
  --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
  --extra-cflags=-I$NDK/sysroot/usr/include \
  --extra-cflags=-I$NDK/sysroot/usr/include/arm-linux-androideabi \
  --extra-cflags=-D__ANDROID_API__=21 \
  --sysroot=$PLATFORM

  make clean
  make -j16
  make install
}

build_one

echo Android ARM builds finished
